package base.day12;

public class StuArray {
    public static void main(String[] args) {
        //定义一个数组，类型为Student
        Student[] array=new Student[3];
        //给Student类中传入参数
        Student stu1=new Student("张三",23);
        Student stu2=new Student("李四",24);
        Student stu3=new Student("王五",25);
        //存入数组
        array[0]=stu1;
        array[1]=stu2;
        array[2]=stu2;
        //循环获取
        for (int i = 0; i < array.length; i++) {
            Student temp=array[i];
            System.out.println(temp.getName()+","+ stu1.getAge());
        }
    }
}
